package com.lcy.service.impl;

import com.lcy.mapper.AiCodeAnalysisMapper;
import com.lcy.model.entity.AiCodeAnalysis;
import com.lcy.service.AiCodeAnalysisService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@Service
public class AiCodeAnalysisServiceImpl implements AiCodeAnalysisService {
    @Resource
    private AiCodeAnalysisMapper aiCodeAnalysisMapper;
    @Transactional // 添加事务注解
    @Override
    public void saveAnalysis(AiCodeAnalysis analysis) {
        aiCodeAnalysisMapper.insert(analysis);
    }

    @Override
    public Optional<AiCodeAnalysis> getAnalysisByProblemSubmitId(Long problemSubmitId) {
        return aiCodeAnalysisMapper.findByProblemSubmitId(problemSubmitId);
    }
} 